<template>
  <div class="home">
    <div ref="banner" class="banner content-item-block">
      <div class="video-wrapper">
        <video
            ref="video"
            class="video"
            preload="auto"
            muted
            loop
            playsinline
            autoplay
            poster="//sf3-ttcdn-tos.pstatp.com/obj/ttfe/ATSX/mainland/video-poster_1576231362701.png"
            src="//sf1-ttcdn-tos.pstatp.com/obj/ttfe/ATSX/mainland/gongquhunjian_1080.min.mp4"
            tabindex="-1"
        ></video>
      </div>
      <h1 class="banner-title">
        和优秀的人 做有挑战的事
        <div class="subTitle">JOIN NUTRECRUIT</div>
      </h1>
      <div class="bottom-tips">
        <span class="arrow-down" @click="scrollDown">
          <i>⤓</i>
        </span>
        <span class="vertical-dashed"></span>
      </div>
    </div>

    <!-- 产品 -->
    <div class="main">
      <div ref="product" class="product content-item-block">
        <h1 class="title">探索你感兴趣的功能</h1>
        <ul class="job-category-list clearfix">
          <li class="job-category-item">
            <router-link to="enterpriseResume">
              <div class="image" style="backgroundImage:url(https://sf1-ttcdn-tos.pstatp.com/obj/ttfe/ATSX/mainland/jobslight/support2.png)">
              </div>
              <div class="name">查看所有简历</div>
            </router-link>
          </li>
          <li class="job-category-item">
            <router-link to="enterpriseInfo">
              <div class="image" style="backgroundImage:url(https://sf1-ttcdn-tos.pstatp.com/obj/ttfe/ATSX/mainland/jobslight/sales2.png)">
              </div>
              <div class="name">企业基本信息</div>
            </router-link>
          </li>
          <li class="job-category-item">
            <router-link to="enterpriseRecruit">
              <div class="image" style="backgroundImage:url(https://sf1-ttcdn-tos.pstatp.com/obj/ttfe/ATSX/mainland/jobslight/operation2.png)">
              </div>
              <div class="name">招聘信息</div>
            </router-link>
          </li>
          <li class="job-category-item">
<!--            <router-link >-->
              <div class="image" style="backgroundImage:url(	https://sf1-ttcdn-tos.pstatp.com/obj/ttfe/ATSX/mainland/jobslight/rd2.png)">
                <span class="overlay" >· · ·</span>
              </div>
<!--            </router-link>-->
          </li>
        </ul>
      </div>

    </div>
  </div>
</template>

<script>

export default {
  name: "home",
  data() {
    return {
      productLayerVisible: true,
      search: "",
      products: [],
      jobCategories: [],
      byteStandards: [],
      byteStandardActiveIndex: 0,
      staffStories: []
    };
  },
  methods: {
    scrollDown() {
      this.$refs.product.scrollIntoView({
        behavior: "smooth",
        block: "start"
      });
    },
    jumpToDetail(item) {
      this.$router.push({ name: "products", params: item });
    }
  },
  mounted() {
    const rootVm = this.$root;
    rootVm.$emit(
        "home-scrolling",
        { directionX: 1, directionY: -1 },
        { x: document.body.scrollLeft, y: document.body.scrollTop }
    );
    this.unwatch = watchScrollDirection(window, function(...args) {
      rootVm.$emit("home-scrolling", ...args);
    });
  },
  destroyed() {
    this.unwatch();
  }
};
</script>

<style lang="less" scoped>
div.name{
  font-size: 22px;
}

h1.title{
  font-size: 32px;
}

@keyframes verticalMotion {
  0% {
    transform: translateY(6px);
  }
  50% {
    transform: translateY(-6px);
  }
  100% {
    transform: translateY(6px);
  }
}
@keyframes scrollToRight {
  0% {
    left: -100%;
  }

  100% {
    left: 100%;
  }
}

.home {
  .main {
    //width: @main-width;
    margin: auto;
  }
  .content-item-block {
    .title {
      //font-size: @font-size-larger;
    }
  }
}

.banner {
  height: 100vh;
  min-height: 400px;
  //min-width: @main-width;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: rgba(51, 112, 255, 0.2);
  position: relative;
  .video-wrapper {
    font-size: 0;
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: -1;
    overflow: hidden;
    .video {
      object-fit: cover;
      width: 100%;
      height: 100%;
    }
  }
  &-title {
    color: #fff;
    font-size: 60px;
    text-align: center;
    .subTitle {
      position: relative;
      margin-top: 10px;
      font-size: 14px;
      letter-spacing: 20px;
      &::after,
      &::before {
        content: "";
        position: absolute;
        background-image: linear-gradient(
            270deg,
            hsla(0, 0%, 100%, 0),
            #fff 47%,
            hsla(0, 0%, 100%, 0)
        );
        height: 2px;
        width: 89px;
        top: 50%;
        transform: translateY(-50%);
      }
      &:before {
        right: 10px;
      }
      &:after {
        left: 10px;
      }
      position: relative;
      margin-top: 10px;
      //font-size: @font-size-base;
      letter-spacing: 20px;
    }
  }
  .search {
    width: 500px;
    margin-top: 100px;
    margin-bottom: 40px;
  }
  .bottom-tips {
    position: absolute;
    bottom: 30px;
    width: 50px;
    height: 50px;
    flex-shrink: 0;

    text-align: center;
    .arrow-down {
      display: block;
      margin-bottom: 4px;
      width: 100%;
      height: 100%;
      border-radius: 50%;
      border: 1px solid #fff;
      text-align: center;
      line-height: 40px;
      color: #fff;
      cursor: pointer;
      font-size: 21px;
      i {
        animation: verticalMotion 1.3s infinite linear;
        display: inline-block;
        font-style: normal;
      }
    }
    // 分割竖线
    .vertical-dashed {
      border-left: 1px dashed #fff;
      height: 30px;

      display: inline-block;
    }
  }
}

// 产品
.product {
  margin-top: 40px;
  text-align: center;
  padding: 40px 40px;
  background: url(//sf1-ttcdn-tos.pstatp.com/obj/ttfe/ATSX/mainland/global.png);
  background-size: 100%;
  background-repeat: no-repeat;
  background-position: 0 370px;
  .desc {
    margin: 40px 0;
  }
  &-list {
    display: flex;
    justify-content: space-between;
    width: 100%;
  }
  &-item {
    width: 90px;
    // height: 90px;
    cursor: pointer;
    &:nth-child(1),
    &:nth-child(9) {
      margin-top: 116px;
    }
    &:nth-child(2),
    &:nth-child(8) {
      margin-top: 80px;
    }
    &:nth-child(3),
    &:nth-child(7) {
      margin-top: 55px;
    }
    &:nth-child(4),
    &:nth-child(6) {
      margin-top: 30px;
    }
    &:hover {
      //color: @main-color;
      img {
        border-radius: 19px;

        transform: scale(1.2);
        transform-origin: bottom;
        box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
      }
    }
    img {
      width: 90px;
      height: 90px;
      border-radius: 19px;

      margin-bottom: 10px;
      transition: transform 0.3s;
    }
  }
  .more {
    margin: auto;
    margin-top: 170px;

    width: 149px;
  }
}

// 职位

.job-category {
  text-align: center;
  margin-top: 90px;

  &-list {
    margin-top: 70px;
  }
  &-item {
    float: left;
    margin-bottom: 16px;
    .image {
      width: 250px;
      height: 250px;
      line-height: 250px;
      background-repeat: no-repeat;
      background-size: 100%;
      border-radius: 50%;
      margin: 0 auto;

      transition: all 0.3s;
      background-position: center;
      overflow: hidden;
      &:hover {
        box-shadow: 0 0 8px 1px #ccc;
        background-size: 110%;
        & + .name {
          //color: @main-color;
        }
      }
      .overlay {
        user-select: none;
        display: inline-block;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.5);
        color: #fff;
        font-size: 40px;
      }
    }
    .name {
      margin-top: 23px;
      //font-size: @font-size-large;
    }
    margin: 0 2.5%;
    margin-bottom: 30px;
    width: 20%;
  }
}

</style>